package o;

import java.util.Arrays;

public class fyu implements fyh, fyw {
    private int ʻ;
    private fzc[] ʼ = new fzc[this.ॱॱ];
    private int ʽ = 0;
    private final fyt ˊ;
    private int ˋ = 0;
    private int[] ˎ;
    private int ˏ;
    private int ॱ;
    private int ॱॱ = 16;

    public fyu(fyt o_fyt) {
        for (int i = 0; i < this.ॱॱ; i++) {
            this.ʼ[i] = new fzc();
        }
        this.ॱ = 16;
        this.ˏ = 0;
        this.ˎ = new int[this.ॱ];
        this.ˊ = o_fyt;
        this.ʻ = -1;
    }

    public final int ˎ(fyg o_fyg, Object obj) {
        int ˊ = this.ˊ.ˊ(o_fyg, obj);
        this.ˋ++;
        ॱ(ˊ);
        return ˊ;
    }

    public final void ˏ(int i) {
        ˎ(i);
        this.ˋ--;
        this.ˊ.ˎ(i);
    }

    public final void ˎ(int i, fyg o_fyg, fzp o_fzp) {
        if (this.ˊ.ˋ(i, o_fyg, o_fzp)) {
            ॱ(i);
        }
    }

    public Object ˋ(int i) {
        return this.ˊ.ˊ(i);
    }

    public boolean ˊ(int i, int i2) {
        fyg ˋ = this.ˊ.ˋ(i);
        fyg ˋ2 = this.ˊ.ˋ(i2);
        if (ˋ2.ˋ.ˊ - ˋ.ॱ.ˊ > 0.0f || ˋ2.ˋ.ॱ - ˋ.ॱ.ॱ > 0.0f || ˋ.ˋ.ˊ - ˋ2.ॱ.ˊ > 0.0f || ˋ.ˋ.ॱ - ˋ2.ॱ.ॱ > 0.0f) {
            return false;
        }
        return true;
    }

    public final void ˎ(fyi o_fyi) {
        int i = 0;
        this.ʽ = 0;
        for (int i2 = 0; i2 < this.ˏ; i2++) {
            this.ʻ = this.ˎ[i2];
            if (this.ʻ != -1) {
                this.ˊ.ˎ(this, this.ˊ.ˋ(this.ʻ));
            }
        }
        this.ˏ = 0;
        Arrays.sort(this.ʼ, 0, this.ʽ);
        while (i < this.ʽ) {
            fzc o_fzc = this.ʼ[i];
            o_fyi.ˎ(this.ˊ.ˊ(o_fzc.ˎ), this.ˊ.ˊ(o_fzc.ॱ));
            i++;
            while (i < this.ʽ) {
                fzc o_fzc2 = this.ʼ[i];
                if (o_fzc2.ˎ != o_fzc.ˎ || o_fzc2.ॱ != o_fzc.ॱ) {
                    break;
                }
                i++;
            }
        }
    }

    protected final void ॱ(int i) {
        if (this.ˏ == this.ॱ) {
            Object obj = this.ˎ;
            this.ॱ *= 2;
            this.ˎ = new int[this.ॱ];
            System.arraycopy(obj, 0, this.ˎ, 0, obj.length);
        }
        this.ˎ[this.ˏ] = i;
        this.ˏ++;
    }

    protected final void ˎ(int i) {
        for (int i2 = 0; i2 < this.ˏ; i2++) {
            if (this.ˎ[i2] == i) {
                this.ˎ[i2] = -1;
            }
        }
    }

    public final boolean ˊ(int i) {
        if (i != this.ʻ) {
            if (this.ʽ == this.ॱॱ) {
                Object obj = this.ʼ;
                this.ॱॱ *= 2;
                this.ʼ = new fzc[this.ॱॱ];
                System.arraycopy(obj, 0, this.ʼ, 0, obj.length);
                for (int length = obj.length; length < this.ॱॱ; length++) {
                    this.ʼ[length] = new fzc();
                }
            }
            if (i < this.ʻ) {
                this.ʼ[this.ʽ].ˎ = i;
                this.ʼ[this.ʽ].ॱ = this.ʻ;
            } else {
                this.ʼ[this.ʽ].ˎ = this.ʻ;
                this.ʼ[this.ʽ].ॱ = i;
            }
            this.ʽ++;
        }
        return true;
    }
}
